//
//  Regist1ViewController.m
//  pz_live
//
//  Created by caiyc on 2018/9/17.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "Regist1ViewController.h"
#import "Regist2ViewController.h"

@interface Regist1ViewController ()<UITextFieldDelegate>

@end

@implementation Regist1ViewController
//获取验证码
- (IBAction)getValid:(UIButton *)sender {
//    if([self.mob_Tf.text isEqualToString:@""]){
//        [WToast showWithText:@"请输入正确的手机号"];
//        return;
//    }
//    
//    NSString *md5Str = [NSString stringWithFormat:@"km%@bz",self.mob_Tf.text];
//    NSString *tokens = [XTool md5:md5Str];
//    NSDictionary *param = @{@"ctrl":@"common",@"mobile":self.mob_Tf.text,@"captcha":tokens};
//    AFHTTPRequestOperationManager *manager=[AFHTTPRequestOperationManager manager];
//    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
//
//    NSMutableDictionary *params = [[NSMutableDictionary alloc]initWithDictionary:param];
//    [params setObject:@"10" forKey:@"i"];
//    [params setObject:@"bz_activities" forKey:@"m"];
//    [params setObject:@"entry" forKey:@"c"];
//    [params setObject:@"code" forKey:@"ac"];
//    [manager POST:BASE_URL parameters:params success:^(AFHTTPRequestOperation * _Nonnull operation, id  _Nonnull responseObject) {
//        SLog(@"请求结果===%@",responseObject);
//    } failure:^(AFHTTPRequestOperation * _Nullable operation, NSError * _Nonnull error) {
//        NSLog(@"请求出错===%@",error);
//    }];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.mob_Tf.delegate = self;
    self.valid_Tf.delegate = self;
    self.botom_ScroView.contentSize = CGSizeMake(screen_width, screen_height*1.2);
    self.botom_ScroView.showsVerticalScrollIndicator = 0;
  
    // Do any additional setup after loading the view from its nib.
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    
    if (textField == self.mob_Tf) {
        //这里的if时候为了获取删除操作,如果没有次if会造成当达到字数限制后删除键也不能使用的后果.
        if (range.length == 1 && string.length == 0) {
            return YES;
        }
        //so easy
        else if (self.mob_Tf.text.length >= 11) {
            self.mob_Tf.text = [textField.text substringToIndex:11];
            return NO;
        }
    }
    return YES;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)next_Action:(UIButton *)sender {
    Regist2ViewController *vc = [[Regist2ViewController alloc]init];
    [self presentViewController:vc animated:YES completion:nil];
}
@end
